package com.yzh.pinboard.BoardView;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * Created by Rex on 2017/2/22.
 */

public class Stroke implements Serializable {

    public List<Point> points = new ArrayList<Point>();
    int color;
    float width;
    public String id;

    public void Stroke() {
        this.id = UUID.randomUUID().toString();
    }

    //获取线集合最右边坐标
    public float GetMaxX() {
        float maxX = 0;

        for (int i = 0; i < this.points.size(); i++) {
            if (this.points.get(i).X > maxX) {
                maxX = this.points.get(i).X;
            }
        }
        return maxX;
    }

    public float GetMinX() {
        float minX = 100000000;
        for (int i = 0; i < this.points.size(); i++) {
            if (this.points.get(i).X < minX) {
                minX = this.points.get(i).X;
            }
        }
        return minX;
    }


    public float GetMaxY() {
        float maxY = 0;

        for (int i = 0; i < this.points.size(); i++) {
            if (this.points.get(i).Y > maxY) {
                maxY = this.points.get(i).Y;
            }
        }
        return maxY;
    }

    public float GetMinY() {
        float MinY = 100000000;
        for (int i = 0; i < this.points.size(); i++) {
            if (this.points.get(i).Y < MinY) {
                MinY = this.points.get(i).Y;
            }
        }
        return MinY;
    }

}
